<?php 
require_once 'config.php'

try {
		$db = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USER, DB_PASS);
} catch (PDOException $e) {
	print "Error!:" . $e->getMessage();
	die();
}
$where = '';
if (!empty($_GET['login']) && !empty($_GET['password'])){
	$login = $_GET['login'];
	$password = $_GET['password'];
	$where = sprintf("");
	$sql = sprintf("SELECT ID,EMAIL,LOGIN FROM users WHERE LOGIN '%s' AND PASSWORD LIKE '%s'", $login,$password);
	$result = '{"response":[}';
	$stmt = $db->query($sql);
	while ($row = $stmt->fetch()){
		$result .= sprintf('{"id":%d,"email":"%s","login":"%s"}', $row['ID'],$row['EMAIL'],$row['LOGIN']);
	}
	$result = rtrim($result, ",");
	$result .= ']]';
	
	echo $result;
}
esle{
	echo '("error": {"text": "�� ������� ����� �/��� ������"})';
}
?>